#Requires AutoHotkey v2.0

OnMessage(5,switchToggle)

global ToggleCaseConversion := 1
caseConversion(letter) { 
  Critical
  global ToggleCaseConversion
  if KeyWait(letter, "T 0.5") {
    if (A_TimeSinceThisHotkey > 150) {
      send '+' . letter 
    } else {
      send letter
    }
  } else {
    ToggleCaseConversion := 0
    KeyWait(letter)
    ToggleCaseConversion := 1
  } 
}

switchToggle(*) {
  global
  ToggleCaseConversion := !ToggleCaseConversion
}

#HotIf ToggleCaseConversion
$a:: caseConversion('a')
$b:: caseConversion('b')
$c:: caseConversion('c')
$d:: caseConversion('d')
$e:: caseConversion('e')
$f:: caseConversion('f')
$g:: caseConversion('g')
$h:: caseConversion('h')
$i:: caseConversion('i')
$j:: caseConversion('j')
$k:: caseConversion('k')
$l:: caseConversion('l')
$m:: caseConversion('m')
$n:: caseConversion('n')
$o:: caseConversion('o')
$q:: caseConversion('q')
$p:: caseConversion('p')
$r:: caseConversion('r')
$s:: caseConversion('s')
$t:: caseConversion('t')
$u:: caseConversion('u')
$v:: caseConversion('v')
$w:: caseConversion('w')
$x:: caseConversion('x')
$y:: caseConversion('y')
$z:: caseConversion('z')
$`;:: caseConversion(';')
$.:: caseConversion('.')
$,:: caseConversion(',')
$/:: caseConversion('/')
#HotIf 